<!DOCTYPE HTML>
<html>
	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
		<meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    	<title>统战成员学习平台</title>
	    <link rel="stylesheet" type="text/css" href="../../css/base.css" />
	    <link rel="stylesheet" type="text/css" href="../../css/style.css" />
	</head>
	<body class="white">
		<div id='app' style="display:none" v-show="true">
			<div class="exam_result_info">
				<div :class="isQualified?'passed':'not_passed'">
					<p class="chapter"><i class="icon_chapter"></i>{{name}}</p>
					<p class="question_sum">试题：{{questions.length}}</p>
					<p class="question_error">错误：{{errorNum}}</p>
					<p class="score"><span>{{score}}</span>分</p>
				</div>
			</div>
			<p class="answer_list ui_border_t ui_border_b">考试详情</p>
			<ul class="question_list" :style="{'height': height - 330 + 'px'}">
				<li v-for="(item, i) of questions" @click="checkAnswer(i)" :class="{'active': item.isCorrect}"><span>{{i+1}}</span></li>
			</ul>
			<div tapmode='tap' @click="reExam()" class="start_exam">重新考试</div>
			<p class="last_exam_time">剩余次数：{{flunkNum === -1 ? '不限次数' : flunkNum}}</p>
		</div>
		<script type="text/javascript" src="../../script/api.js"></script>
		<script type="text/javascript" src="../../script/vue.min.js"></script>
		<script type="text/javascript" src="../../script/common.js"></script>
		<script type="text/javascript" src="../../script/layer_mobile/layer.js"></script>
		<script type="text/javascript">
		    new Vue({
				el: '#app',
		     	data: {
					height: 400,
					name: '',
					scoreId: 0,
					questions: [],
					isQualified: 0,
					errorNum: 0,
					score: 0,
					flunkNum: 0
		     	},
				mounted: function() {
		        	var $this = this;
		        	apiready = function() {
						$this.scoreId = api.pageParam.scoreId;
						$this.name = api.pageParam.name;
						$this.height = api.frameHeight;
						$this.init();
						parseTapmode();
                	}
		    	},
		    	methods: {
					init: function() {
						var $this = this;
						var indexs = ['A', 'B', 'C', 'D', 'E', 'F', 'G'];
						post('/client/exam/showExamDeatil', {
							scoreId: $this.scoreId
						}, function(ret) {
							if(ret.isSuccess) {
								$this.score = ret.data.score;
								$this.isQualified = ret.data.isQualified;
								$this.errorNum = ret.data.errorNum;
								$this.flunkNum = ret.data.flunkNum;
								$this.questions = ret.data.paperList;
								$api.setStorage (_.EXAMEDANSWER, ret.data.paperList.map(function(item) {
									item.optionList.map(function(option, index) {
										option.index = indexs[index];
										return option;
									})
									return item;
								}));
							} else {
								msgUtil.toast({
								    msg: ret.message
								});
							}
						})
					},
					checkAnswer: function(i) {
						openWin('check_examed_answer_win', {index: i})
					}
		    	}
		    });
		</script>
	</body>
</html>
